#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<stack>
using namespace std;




struct TreeNode {
    int val;
    TreeNode* left;
    TreeNode* right;
    TreeNode() : val(0), left(nullptr), right(nullptr) {}
    TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
    TreeNode(int x, TreeNode* left, TreeNode* right) : val(x), left(left),
         right(right) {}
    
};
class Solution {
public:
    vector<int> inorderTraversal(TreeNode* root) {
        stack<TreeNode*> v;
        vector<int> answer;
        TreeNode* cur = root;

        while (cur || !v.empty())
        {

            while (cur)
            {
                v.push(cur);
                cur = cur->left;
            }
            TreeNode* top = v.top();
            v.pop();
            answer.push_back(top->val);
            cur = top->right;
        }
        return answer;
    }
};
int main()
{
    vector<int> h = { 3, 9, 20, 15, 7 };

};
